<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/5 0005
 * Time: 上午 10:43
 */
namespace Admin\Model;
use Think\Model;
class Comment_replyModel extends Model
{
    //评论时允许接收的字段
    protected $insertFields = array('comment_id', 'content');
    protected $updateFields =  array('comment_id', 'content');
    protected $_validate = array(
        array('comment_id', 'require', '参数错误！', 1),
        array('content', '1,200', '内容必须是1-200个字符之间', 1, 'length'),

    );
    public function _before_insert(&$data,$option)
    {
        $memberId = session('m_id');
        if (!$memberId) {
            $this->error = '必须先登录！';
            return FALSE;
        } else {
            $data['addtime'] = date('Y-m-d H:i:s');
            $data['member_id'] = $memberId;
        }
    }
}